home *** CD-ROM | disk | FTP | other *** search
- /*
- ** This is the TApp class declaration. This class is an adaptation of
- ** the class of the same name in the book, Elements of C++ Macintosh
- ** Programming, by Dan Weston.
- **
- ** Copyright © 1991 Mark Gross
- ** (RR2, Box 84, Clayville, NY 13322);
- ** this file may be published everywhere, but no charge
- ** may be made for its use. Please contact me about any bugs found.
- ** I'm also looking for Macintosh development work, so drop me a line
- ** if you think I could help.
- **
- */
-
-
- #define _H_TApp
- #include "TDoc.h"
- #include "TList.h"
- #include "TIterator.h"
-
-
-
- struct TApp:indirect
- {
- SysEnvRec fenvRec;
- TList *fDocList;
- TDoc *fCurDoc;
- Boolean fHaveWaitNextEvent;
- Boolean fDone;
- Boolean fInBackground;
- Handle fClipData;
- OSType fClipType;
- SFTypeList fFileTypeList;
- Boolean fDAonTop;
- short fLastScrapCount;
-
-
- /*
- ** member fumctions follow
- */
-
- /* clipboard support */
- OSType CanAcceptClipType(void);
- void GetClipFromSystem(void);
- void GiveClipToSystem(void);
- Boolean ClipHasChanged(void);
- void CheckForDASwitch(WindowPtr theFrontWindow);
-
- /* constructor and destructor */
- TApp* Init(void);
- Boolean TrapAvailable(void);
- void Delete(void);
-
- /* initializing the application */
- Boolean InitApp(void);
-
- /*cleaning up after the application */
- void CleanUp(void);
-
- /* making documents */
- TDoc* MakeDoc(SFReply *reply);
- OSType GetCreator(void);
- void AddDocument(TDoc *theDoc);
-
- /* opening new documents */
- void OpenNewDoc(void);
-
- /* opening old documents */
- int GetNumFileTypes(void);
- void GetFileTypeList(void);
- void OpenOldDoc(void);
- Boolean InitOldDoc(SFReply *reply);
-
- /* opening documents form finder */
- Boolean OpenDocFromFinder(void);
- Boolean AcceptableFileType(OSType theType);
-
- /* deleting documents */
- Boolean CloseADoc(TDoc *theDoc);
-
- /* handling events */
- void EventLoop(void);
-
- void AppIdle(void);
- void DiskEvt(EventRecord *theEvent);
-
- void MouseUp(EventRecord *theEvent);
- void MouseDown(EventRecord *theEvent);
- void KeyDown(EventRecord *theEvent);
- void ActivateEvt(EventRecord *theEvent);
- void UpdateEvt(EventRecord *theEvent);
-
- /* Multifinder support */
- void OSEvent(EventRecord *theEvent);
-
- void DoSuspend(EventRecord *theEvent, Boolean convertClip);
- void DoResume(EventRecord *theEvent, Boolean convertClip);
-
- /* handling menus */
- void SetMenuAbility(MenuHandle menu, short item, Boolean enable);
-
- void AdjustMenus(void);
- Boolean CanOpen(void);
-
- void DoMenuCommand(short menuID, short menuItem);
-
- void Quit(void);
- void ExitLoop(void);
-
- void DoUndoCmd(TDoc *theDoc);
- void DoPasteCmd(TDoc *theDoc);
- void DoCutCmd(TDoc *theDoc);
- void DoCopyCmd(TDoc *theDoc);
-
-
- };/*end of class definition of TDoc class*/
-
-